package cn.bonoon.entities;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import cn.bonoon.kernel.support.IOperator;
import cn.bonoon.kernel.support.entities.AbstractPersistable;
import cn.bonoon.kernel.support.entities.EntityScopable;
@MappedSuperclass
public abstract class RawdataImportExportEntity extends AbstractPersistable implements EntityScopable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 448410258824862518L;

	/** 用于处理该文件的处理器；如果没有找到相应的处理器，则表示这个处理器已经过期，被放弃了 */
	@Column(name = "C_KEY", length = 50)
	private String key;

	@Column(name = "C_TITLE", length = 200)
	private String title;
	@Column(name = "C_CATALOG", length = 200)
	private String catalog;

	/** 总的有多少记录 */
	@Column(name = "C_TOTAL")
	private int total;

	@Column(name = "C_OWNERID")
	private long ownerId;

	@Column(name = "C_CREATORNAME", length = 50)
	private String creatorName;
	
	@Column(name = "C_CREATORID")
	private Long creatorId;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "C_CREATEAT", nullable = false)
	private Date createAt;

	/* 下面4个字段是用来存放自定义内容的 */
	@Column(name = "C_ARG0")
	private Long larg0;
	@Column(name = "C_ARG1")
	private Long larg1;
	@Column(name = "C_ARG2")
	private String sarg0;
	@Column(name = "C_ARG3")
	private String sarg1;
	
	/**
	 * 是否删除
	 */
	@Column(name = "C_DELETED")
	private boolean deleted;


	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}
	public String getCreatorName() {
		return creatorName;
	}

	public void setCreatorName(String creatorName) {
		this.creatorName = creatorName;
	}

	public Long getCreatorId() {
		return creatorId;
	}

	public void setCreatorId(Long creatorId) {
		this.creatorId = creatorId;
	}

	public Date getCreateAt() {
		return createAt;
	}

	public void setCreateAt(Date createAt) {
		this.createAt = createAt;
	}
	public void operator(IOperator operator){
		this.ownerId = operator.getOwnerId();
		this.creatorId = operator.getId();
		this.creatorName = operator.getUsername();
	}

	public long getOwnerId() {
		return ownerId;
	}

	public void setOwnerId(long ownerId) {
		this.ownerId = ownerId;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getCatalog() {
		return catalog;
	}

	public void setCatalog(String catalog) {
		this.catalog = catalog;
	}

	public Long getLarg0() {
		return larg0;
	}

	public void setLarg0(Long larg0) {
		this.larg0 = larg0;
	}

	public Long getLarg1() {
		return larg1;
	}

	public void setLarg1(Long larg1) {
		this.larg1 = larg1;
	}

	public String getSarg0() {
		return sarg0;
	}

	public void setSarg0(String sarg0) {
		this.sarg0 = sarg0;
	}

	public String getSarg1() {
		return sarg1;
	}

	public void setSarg1(String sarg1) {
		this.sarg1 = sarg1;
	}

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}
	
}
